import os
import cv2
import numpy as np
bace_path = r"/dssg/home/zhineng_qt/test_2021_3_18_fu/dataset/car1000_2/car1000/labels"
save_path = r'/dssg/home/zhineng_qt/test_2021_3_18_fu/dataset/car1000_2/car1000/masks'

if not os.path.exists(save_path):
    os.makedirs(save_path)

for im in os.listdir(bace_path):
    img = cv2.imread(os.path.join(bace_path, im))
    b, g, r = cv2.split(img)
    r[np.where(r != 0)] = 255
    print(r)
    cv2.imwrite(os.path.join(save_path, im), r)
